package com.ycsj.goldmedalnewconcept.teacher.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


/**
 * Created by lenovo on 2016/9/7.
 */
public abstract class CommonFragment extends Fragment {

    private View rootView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = View.inflate(getActivity(), getLayoutId(), null);
        return rootView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        init(rootView, savedInstanceState);
    }

    /**
     * 返回布局ID的方法
     *
     * @return
     */
    protected abstract int getLayoutId();

    /**
     * 初始化方法
     */
    protected abstract void init(View view, Bundle savedInstanceState);

}
